
/***************************************************************************
**
** Copyright �2002 by Hellosoft Inc. All rights reserved. No part
** of this publication, or any software included with it, may be
** reproduced, stored in a retrieval system, or transmitted in
** any form or by any other means, including photocopying,
** electronic or mechanical recording or otherwise, without
** prior written permission of the copyright holder
**
** Hellosoft Confidential and Proprietary information
**
** File			: mac_debug.h
**
** Start Date	: Fri Jan 4 2002
**
** Email		: wlan-nw@hyd.hellosoft.com
**
***************************************************************************/

#ifndef __MAC_DEBUG_HEADER__
#define __MAC_DEBUG_HEADER__

extern HS_INT32 is_trace_enabled_g ;

/* macros for sizes of log messages */

#define CONTROL_LOGMSG_SIZE		5000
#define ERROR_LOGMSG_SIZE		5000
#define PHY_LOGMSG_SIZE			5000
#define MAC_LOGMSG_SIZE			5000
#define ISR_LOGMSG_SIZE			5000
#define	DPRAM_LOGMSG_SIZE		5000
#define ENCODE_LOGMSG_SIZE		2500
#define TIMER_LOGMSG_SIZE		2500

//#define GUI_ON
/* #define GUI_ON  */

/* macro used to control printf statements in the files */
#ifndef GUI_ON



//	#define SBISR_DEBUG_ON		10
//	#define SBMAC_DEBUG_ON		9
//	#define ERROR_DEBUG_ON		1


/*
	#define CONTROL_DEBUG_ON 	2

	#define STATUS_DEBUG_ON		3
	#define PHY_DEBUG_ON		4
	#define MAC_DEBUG_ON		5
	#define ISR_DEBUG_ON		6
	#define DPRAM_DEBUG_ON		7
	#define ENCODE_DEBUG_ON		8
*/


#endif

#define TRACE(x) { if(is_trace_enabled_g) printf("=====> %s\n", x) ; }

#ifdef SBISR_DEBUG_ON
	#define SBISR_DEBUG(x) 	{ \
					x;\
					printf("\rSBISR: ");\
					printf(sbisr_logmsg);\
					sbisr_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define SBISR_DEBUG(x)	{ \
					x;\
					update_MAC_data(sbisr_logmsg,strlen(sbisr_logmsg));\
					}


	#else
		#define SBISR_DEBUG(x)
	#endif
#endif

#ifdef SBMAC_DEBUG_ON
	#define SBMAC_DEBUG(x) 	{ \
					x;\
					printf("\rSBMAC: ");\
					printf(sbmac_logmsg);\
					sbmac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define SBMAC_DEBUG(x)	{ \
					x;\
					update_MAC_data(sbmac_logmsg,strlen(sbmac_logmsg));\
					}


	#else
		#define SBMAC_DEBUG(x)
	#endif
#endif

#ifdef MAC_DEBUG_ON
	#define MACDEBUG(x) 	{ \
					x;\
					printf("\rMAC: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define MACDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
					}


	#else
		#define MACDEBUG(x)
	#endif
#endif

#ifdef WEXT_DEBUG_ON
	#define WEXTDEBUG(x) 	{ \
					x;\
					printf("\rwext_handler: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define WEXTDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
					}


	#else
		#define WEXTDEBUG(x)
	#endif
#endif

#ifdef WEP_DEBUG_ON
	#define WEPDEBUG(x) 	{ \
					x;\
					printf("\rMAC: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define WEPDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
				}


	#else
		#define WEPDEBUG(x)
	#endif
#endif

#ifdef TKIP_DEBUG_ON
	#define TKIPDEBUG(x) 	{ \
					x;\
					printf("\rMAC: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define TKIPDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
				}


	#else
		#define TKIPDEBUG(x)
	#endif
#endif

#ifdef AES_DEBUG_ON
	#define AESDEBUG(x) 	{ \
					x;\
					printf("\rMAC: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define AESDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
				}


	#else
		#define AESDEBUG(x)
	#endif
#endif

#ifdef MALLOC_DEBUG_ON
	#define MALLOCDEBUG(x) 	{ \
					x;\
					printf("\rMAC: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define MALLOCDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
				}


	#else
		#define MALLOCDEBUG(x)
	#endif
#endif


#ifdef MEM_DEBUG_ON
	#define MEMDEBUG(x) 	{ \
					x;\
					printf("\rMEMORY: ");\
					printf(mac_logmsg);\
					mac_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define MEMDEBUG(x)	{ \
					x;\
					update_MAC_data(mac_logmsg,strlen(mac_logmsg));\
					}


	#else
		#define MEMDEBUG(x)
	#endif
#endif


#ifdef CONTROL_DEBUG_ON
	#define CONTROLDEBUG(x) 	{ \
					x;\
					printf("\rCONTROLMAC: ");\
					printf(control_logmsg);\
					control_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define CONTROLDEBUG(x)	{ \
					x;\
					update_MAC_data(control_logmsg,strlen(control_logmsg));\
					}
	#else
		#define CONTROLDEBUG(x)
	#endif
#endif


#ifdef ISR_DEBUG_ON
	#define ISRDEBUG(x) 	{ \
					x;\
					printf("ISR: ");\
					printf(isr_logmsg);\
					isr_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define ISRDEBUG(x)	{ \
					x;\
					update_MAC_data(isr_logmsg,strlen(isr_logmsg));\
					}


	#else
		#define ISRDEBUG(x)
	#endif
#endif

#ifdef DPRAM_DEBUG_ON
	#define DPRAMDEBUG(x) 	{ \
					x;\
					printf("\rDPRAM: ");\
					printf(dpram_logmsg_g);\
					dpram_logmsg_g[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define DPRAMDEBUG(x)	{ \
					x;\
					update_MAC_data(dpram_logmsg_g,strlen(dpram_logmsg));\
					}


	#else
		#define DPRAMDEBUG(x)
	#endif
#endif


#ifdef ERROR_DEBUG_ON
	#define ERRORDEBUG(x) 	{ \
					x;\
					printf("\rERRORMAC: ");\
					printf(error_logmsg);\
					error_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define ERRORDEBUG(x)	{ \
					x;\
					update_MAC_data(error_logmsg,strlen(error_logmsg));\
					}


	#else
		#define ERRORDEBUG(x)
	#endif
#endif

#ifdef STATUS_DEBUG_ON
	#define STATUSDEBUG(x) 	{ \
					x;\
					printf("\rSTATUS: ");\
					printf(status_logmsg);\
					status_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define STATUSDEBUG(x)	{ \
					x;\
					update_MAC_status(status_logmsg,strlen(status_logmsg));\
					}
	#else
		#define STATUSDEBUG(x)
	#endif
#endif

#ifdef ENCODE_DEBUG_ON
	#define ENCODEDEBUG(x)  { \
		x;\
		printf("ENC_DEC: ");\
		printf("FILENAME : %s, LINENO. : %d", __FILE__, __LINE__);\
		printf(encode_logmsg_g);\
	}

#else
	#define ENCODEDEBUG(x)
#endif

#ifdef PHY_DEBUG_ON
	#define PHYDEBUG(x) 	{ \
					x;\
					printf("\nPHY: ");\
					printf(phy_logmsg);\
					phy_logmsg[0] = '\0';\
				}
#else
	#ifdef GUI_ON
		#define PHYDEBUG(x)	{ \
					x;\
					update_PHY_data(phy_logmsg,strlen(phy_logmsg));\
					}
	#else
		#define PHYDEBUG(x)
	#endif
#endif

/*
#ifdef PHY_DEBUG_ON
	#define PHYSTATUS(x) 	{ \
				}
#else
	#ifdef GUI_ON
		#define PHYSTATUS(x)	{ \
					x;\
					update_PHY_status(phy_status_logmsg,strlen(phy_status_logmsg));\
					}
	#else
		#define PHYSTATUS(x)
	#endif
#endif
*/

#ifdef  TIMER_DEBUG_ON
	#define  TIMERDEBUG(x) 	{ \
					x;\
					printf(timer_logmsg);\
				}
#else
	#ifdef GUI_ON
		#define  TIMERDEBUG(x)	{ \
					x;\
					update_MAC_status(timer_logmsg,strlen(timer_logmsg));\
					}
	#else
		#define  TIMERDEBUG(x)
	#endif
#endif

/* buffers for logging the physical layer messages and MAC layer messages */
#ifdef MAC_DEBUG_ON
extern HS_INT8 phy_logmsg[PHY_LOGMSG_SIZE];
extern HS_INT8 phy_status_logmsg[PHY_LOGMSG_SIZE];
extern HS_INT8 status_logmsg[CONTROL_LOGMSG_SIZE];
extern HS_INT8 isr_logmsg[ISR_LOGMSG_SIZE];
extern HS_INT8 dpram_logmsg_g[DPRAM_LOGMSG_SIZE];
extern HS_INT8 encode_logmsg_g[ENCODE_LOGMSG_SIZE];
#endif

#if defined(WEXT_DEBUG_ON) || defined(MAC_DEBUG_ON) || defined(WEP_DEBUG_ON) || defined(MEM_DEBUG_ON) || defined(AES_DEBUG_ON) || defined(TKIP_DEBUG_ON) || defined(MALLOC_DEBUG_ON)
extern HS_INT8 mac_logmsg[MAC_LOGMSG_SIZE];
#endif

#ifdef SBISR_DEBUG_ON
extern HS_INT8 sbisr_logmsg[MAC_LOGMSG_SIZE];
#endif

#ifdef SBMAC_DEBUG_ON
extern HS_INT8 sbmac_logmsg[MAC_LOGMSG_SIZE];
#endif

#ifdef CONTROL_DEBUG_ON
extern HS_INT8 control_logmsg[CONTROL_LOGMSG_SIZE];
#endif

#ifdef ERROR_DEBUG_ON
extern HS_INT8 error_logmsg[ERROR_LOGMSG_SIZE];
#endif

#ifdef TIMER_DEBUG_ON
extern char timer_logmsg[TIMER_LOGMSG_SIZE];
#endif

#define PRINT_MAC(x)         printf(x)
#define PRINT_MAC2(x,y)      printf(x,y)
#define PRINT_MAC3(x,y,z)    printf(x,y,z)
#define PRINT_MAC4(w,x,y,z)  printf(w,x,y,z)

#endif
